package com.keyinong.caizhengting.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.keyinong.caizhengting.R;
import com.keyinong.caizhengting.tools.HttpTools;
import com.keyinong.caizhengting.entity.TeamdetailEntity;

import java.util.ArrayList;

/**
 * 我的团队详情适配器
 */

public class TeamdetailAdapter extends BaseAdapter {

    Context context;
    ArrayList<TeamdetailEntity> teamdetailList;
    HttpTools httpTools = null;

    public TeamdetailAdapter(Context context, ArrayList<TeamdetailEntity> teamdetailList) {
        super();
        this.context = context;
        this.teamdetailList = teamdetailList;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return teamdetailList.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return teamdetailList.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        final ViewHandle handle;
        if (view == null) {
            handle = new ViewHandle();
            view = LayoutInflater.from(context).inflate(R.layout.item_chengyuan, null);
            handle.tv_name = (TextView) view.findViewById(R.id.tv_chengyuanname);
            handle.tv_phone = (TextView) view.findViewById(R.id.tv_dianhua);
            view.setTag(handle);
        } else {
            handle = (ViewHandle) view.getTag();
        }
        handle.tv_name.setText(teamdetailList.get(position).getName());
//		handle.tv_phone.setText(teamdetailList.get(position).getPhone());
        handle.tv_phone.setText("");
        return view;
    }

    class ViewHandle {
        /**
         * 姓名
         */
        TextView tv_name;
        /**
         * 电话
         */
        TextView tv_phone;
    }
}
